package com.bdqn.common.utitls;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Random;
import java.util.UUID;

/**
 * UUID工具类
 */
public class UUIDUtil {
    /**
     * 生成32位字符串
     * @return
     */
    public static String randomUUID() {
        return UUID.randomUUID().toString().replace("-","");
    }

    /**
     * 根据时间+五位随机数成字符串
     * @param preffx
     * @return
     */
    public static String createRandomStringUseTime(String preffx) {
        Random random=new Random();
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
        return preffx+"_"+dateFormat.format(new Date())+"_"+(random.nextInt(90000)+10000);
    }
}
